from sklearn import datasets
from sklearn import model_selection
from sklearn import linear_model

import matplotlib.pyplot as plt
import numpy as np

from utils import utils
# 加载数据集
cancer = datasets.load_breast_cancer()
X = cancer.data  # 样本
y = cancer.target  # 类别

# 划分数据集
xtrain, xtest, ytrain, ytest = model_selection.train_test_split(X, y, test_size=0.2)

# 调用LogisticRegression
lr = linear_model.LogisticRegression()
lr.fit(xtrain, ytrain)  # 训练
score = lr.score(xtest, ytest)  # 查看预测得分
print("score：", score)

my_model = utils.LogisticRegression()
my_model.fit(xtrain, ytrain)
ypred = my_model.predict(xtest)

score = lr.score(xtest, ypred)
print("score：", score)